﻿using IronBefunge.Core;
using IronBefunge.Core.InstructionHandlers;
using IronBefunge.Core.Tests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Spackle;
using Spackle.Testing;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;

namespace IronBefunge.Core.Tests.InstructionHandlers
{
	[TestClass]
	public sealed class RandomizerInstructionHandlerTests : InstructionHandlerTests
	{
		[TestMethod]
		public void HandleDown()
		{
			RandomizerInstructionHandlerTests.Randomizer(Direction.Down);
		}

		[TestMethod]
		public void HandleLeft()
		{
			RandomizerInstructionHandlerTests.Randomizer(Direction.Left);
		}

		[TestMethod]
		public void HandleRight()
		{
			RandomizerInstructionHandlerTests.Randomizer(Direction.Right);
		}

		[TestMethod]
		public void HandleUp()
		{
			RandomizerInstructionHandlerTests.Randomizer(Direction.Up);
		}

		private static void Randomizer(Direction direction)
		{
			var cells = new List<Cell>() { new Cell(new Point(0, 0), '?') };

			InstructionHandlerTests.Run(new RandomizerInstructionHandler(), cells, null, 
				(context, result) =>
				{
					Assert.AreEqual(direction, context.Direction);
				}, new MockSecureRandom(direction));
		}
	}
}
